<!DOCTYPE HTML>
<html>

<head>
	<link rel="bookmark"  type="image/x-icon"  href="/img/logo_miccall.png"/>
	<link rel="shortcut icon" href="/img/logo_miccall.png">
	
			    <title>
    Ame雨
    </title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
    <link rel="stylesheet" href="/amelin-ting/css/mic_main.css" />
    <link rel="stylesheet" href="/amelin-ting/css/dropdownMenu.css" />
    <meta name="keywords" content="Ame雨" />
    
    	<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
	 
    <noscript>
        <link rel="stylesheet" href="/amelin-ting/css/noscript.css" />
    </noscript>
    <style type="text/css">
        body:before {
          content: ' ';
          position: fixed;
          top: 0;
          background: url('/amelin-ting/img/bg.jpg') center 0 no-repeat;
          right: 0;
          bottom: 0;
          left: 0;
          background-size: cover; 
        }
    </style>

			    
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script async type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


    <script src="/amelin-ting/js/jquery.min.js"></script>
    <script src="/amelin-ting/js/jquery.scrollex.min.js"></script>
    <script src="/amelin-ting/js/jquery.scrolly.min.js"></script>
    <script src="/amelin-ting/js/skel.min.js"></script>
    <script src="/amelin-ting/js/util.js"></script>
    <script src="/amelin-ting/js/main.js"></script>
	
<meta name="generator" content="Hexo 5.4.0"></head>
    
		
<!-- Layouts -->



<!--  代码渲染  -->
<link rel="stylesheet" href="/css/prism_coy.css" />
<link rel="stylesheet" href="/css/typo.css" />
<!-- 文章页 -->
<body class="is-loading">
    <!-- Wrapper 外包 s-->
    <div id="wrapper" class="fade-in">
        <!-- Intro 头部显示 s -->
        <!-- Intro 头部显示 e -->
        <!-- Header 头部logo start -->
        <header id="header">
    <a href="/amelin-ting/" class="logo">Art Space</a>
</header>
        <!-- Nav 导航条 start -->
        <nav id="nav" class="special" >
            <ul class="menu links" >
			<!-- Homepage  主页  --> 
			<li >
	            <a href="/amelin-ting/" rel="nofollow">主页</a>
	        </li>
			<!-- categories_name  分类   --> 
	        
	        <li class="active">
	            <a href="#s1">分类</a>
	                    <ul class="submenu">
	                        <li>
	                        <a class="category-link" href="/amelin-ting/categories/Go/">Go</a></li><li><a class="category-link" href="/amelin-ting/categories/django/">django</a></li><li><a class="category-link" href="/amelin-ting/categories/drf/">drf</a></li><li><a class="category-link" href="/amelin-ting/categories/gin/">gin</a></li><li><a class="category-link" href="/amelin-ting/categories/go/">go</a></li><li><a class="category-link" href="/amelin-ting/categories/linux/">linux</a></li><li><a class="category-link" href="/amelin-ting/categories/mysql/">mysql</a></li><li><a class="category-link" href="/amelin-ting/categories/python/">python</a></li><li><a class="category-link" href="/amelin-ting/categories/%E5%86%85%E7%BD%91%E7%A9%BF%E9%80%8F/">内网穿透</a></li><li><a class="category-link" href="/amelin-ting/categories/%E5%89%8D%E7%AB%AF/">前端</a>
	                    </ul>
	        </li>
	        
	        <!-- archives  归档   --> 
	        
	        
		        <!-- Pages 自定义   -->
		        
		        <li>
		            <a href="/about/" title="简历">
		                简历
		            </a>
		        </li>
		        
		        <li>
		            <a href="/group/" title="团队">
		                团队
		            </a>
		        </li>
		        
		        <li>
		            <a href="/gallery/" title="图库">
		                图库
		            </a>
		        </li>
		        
		        <li>
		            <a href="/tag/" title="标签">
		                标签
		            </a>
		        </li>
		        


            </ul>
            <!-- icons 图标   -->
			<ul class="icons">
                    
                    <li>
                        <a title="github" href="https://github.com/miccall" target="_blank" rel="noopener">
                            <i class="icon fa fa-github"></i>
                        </a>
                    </li>
                    
                    <li>
                        <a title="500px" href="http://500px.com" target="_blank" rel="noopener">
                            <i class="icon fa fa-500px"></i>
                        </a>
                    </li>
                    
			</ul>
</nav>

        <div id="main" >
            <div class ="post_page_title_img" style="height: 25rem;background-image: url(https://img2.baidu.com/it/u=2320068423,660300638&amp;fm=26&amp;fmt=auto);background-position: center; background-repeat:no-repeat; background-size:cover;-moz-background-size:cover;overflow:hidden;" >
                <a href="#" style="padding: 4rem 4rem 2rem 4rem ;"><h2 >Django</h2></a>
            </div>
            <!-- Post -->
            <div class="typo" style="padding: 3rem;">
                <h2 id="一、纯手撸WEB框架"><a href="#一、纯手撸WEB框架" class="headerlink" title="一、纯手撸WEB框架"></a>一、纯手撸WEB框架</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span>HTTP协议</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    网络协议</span></span><br><span class="line"><span class="string">    HTTP协议				数据传输是明文</span></span><br><span class="line"><span class="string">    HTTPS协议				数据传输是密文</span></span><br><span class="line"><span class="string">    websocket协议		数据传输是密文</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    四大特性</span></span><br><span class="line"><span class="string">        1.基于请求响应</span></span><br><span class="line"><span class="string">        2.基于TCP、IP作用于应用层之上的协议</span></span><br><span class="line"><span class="string">        3.无状态</span></span><br><span class="line"><span class="string">        4.短/无链接</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    数据格式</span></span><br><span class="line"><span class="string">        请求首行</span></span><br><span class="line"><span class="string">        请求头</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">        请求体</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">    响应状态码</span></span><br><span class="line"><span class="string">        1XX</span></span><br><span class="line"><span class="string">        2XX			200</span></span><br><span class="line"><span class="string">        3XX			</span></span><br><span class="line"><span class="string">        4XX			403 404</span></span><br><span class="line"><span class="string">        5XX			500</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line"><span class="number">2.</span>如何做到后缀的不同返回不同的内容</span><br><span class="line">	拿到用户输入的后缀 做判断 </span><br><span class="line"></span><br><span class="line"><span class="number">3.</span> 代码演示</span><br><span class="line">    <span class="comment"># 你可以将web框架理解成服务端</span></span><br><span class="line">    <span class="keyword">import</span> socket</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    server = socket.socket()  <span class="comment"># TCP  三次握手四次挥手  osi七层</span></span><br><span class="line">    server.bind((<span class="string">&#x27;127.0.0.1&#x27;</span>,<span class="number">8080</span>))  <span class="comment"># IP协议 以太网协议 arp协议...</span></span><br><span class="line">    server.listen(<span class="number">5</span>)  <span class="comment"># 池 ...</span></span><br><span class="line"></span><br><span class="line">    <span class="keyword">while</span> <span class="literal">True</span>:</span><br><span class="line">        conn, addr = server.accept()</span><br><span class="line">        data = conn.recv(<span class="number">1024</span>)</span><br><span class="line">        <span class="comment"># print(data)  # 二进制数据</span></span><br><span class="line">        data = data.decode(<span class="string">&#x27;utf-8&#x27;</span>)  <span class="comment"># 字符串</span></span><br><span class="line">        <span class="comment"># 获取字符串中特定的内容       正则  如果字符串有规律也可以考虑用切割</span></span><br><span class="line">        conn.send(<span class="string">b&#x27;HTTP/1.1 200 OK\r\n\r\n&#x27;</span>)</span><br><span class="line">        current_path = data.split(<span class="string">&#x27; &#x27;</span>)[<span class="number">1</span>]</span><br><span class="line">        <span class="comment"># print(current_path)</span></span><br><span class="line">        <span class="keyword">if</span> current_path == <span class="string">&#x27;/index&#x27;</span>:</span><br><span class="line">            <span class="comment"># conn.send(b&#x27;index heiheihei&#x27;)</span></span><br><span class="line">            <span class="keyword">with</span> <span class="built_in">open</span>(<span class="string">r&#x27;templates/01 myhtml.html&#x27;</span>, <span class="string">&#x27;rb&#x27;</span>) <span class="keyword">as</span> f:</span><br><span class="line">                conn.send(f.read())</span><br><span class="line">        <span class="keyword">elif</span> current_path == <span class="string">&#x27;/login&#x27;</span>:</span><br><span class="line">            conn.send(<span class="string">b&#x27;login&#x27;</span>)</span><br><span class="line">        <span class="keyword">else</span>:</span><br><span class="line">            <span class="comment"># 你直接忽略favicon.ico</span></span><br><span class="line">            conn.send(<span class="string">b&#x27;hello web&#x27;</span>)</span><br><span class="line">        conn.close()</span><br><span class="line"></span><br><span class="line"><span class="number">4.</span>不足之处</span><br><span class="line">	<span class="number">4.1</span> 代码重复(服务端代码所有人都要重复写)</span><br><span class="line">	<span class="number">4.2</span> 手动处理http格式的数据 并且只能拿到url后缀 其他数据获取繁琐(数据格式一样处理的代码其实也大致一样 重复写)</span><br><span class="line">	<span class="number">4.3</span> 并发的问题</span><br></pre></td></tr></table></figure>

<h2 id="二、借助于wsgiref模块帮你撸"><a href="#二、借助于wsgiref模块帮你撸" class="headerlink" title="二、借助于wsgiref模块帮你撸"></a>二、借助于wsgiref模块帮你撸</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> 代码演示</span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;接下来会演示封装好的代码&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 基于wsgiref模块.py</span></span><br><span class="line">    <span class="keyword">from</span> wsgiref.simple_server <span class="keyword">import</span> make_server</span><br><span class="line">    <span class="keyword">from</span> urls <span class="keyword">import</span> urls</span><br><span class="line">    <span class="keyword">from</span> views <span class="keyword">import</span> *</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">run</span>(<span class="params">env, response</span>):</span></span><br><span class="line">        <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">        :param env:请求相关的所有数据</span></span><br><span class="line"><span class="string">        :param response:响应相关的所有数据</span></span><br><span class="line"><span class="string">        :return: 返回给浏览器的数据</span></span><br><span class="line"><span class="string">        &quot;&quot;&quot;</span></span><br><span class="line">        <span class="comment"># print(env)  # 大字典  wsgiref模块帮你处理好http格式的数据 封装成了字典让你更加方便的操作</span></span><br><span class="line">        <span class="comment"># 从env中取</span></span><br><span class="line">        response(<span class="string">&#x27;200 OK&#x27;</span>, [])  <span class="comment"># 响应首行 响应头</span></span><br><span class="line">        current_path = env.get(<span class="string">&#x27;PATH_INFO&#x27;</span>)</span><br><span class="line">        <span class="comment"># if current_path == &#x27;/index&#x27;:</span></span><br><span class="line">        <span class="comment">#     return [b&#x27;index&#x27;]</span></span><br><span class="line">        <span class="comment"># elif current_path == &#x27;/login&#x27;:</span></span><br><span class="line">        <span class="comment">#     return [b&#x27;login&#x27;]</span></span><br><span class="line">        <span class="comment"># return [b&#x27;404 error&#x27;]</span></span><br><span class="line">        <span class="comment"># 定义一个变量 存储匹配到的函数名</span></span><br><span class="line">        func = <span class="literal">None</span></span><br><span class="line">        <span class="keyword">for</span> url <span class="keyword">in</span> urls:  <span class="comment"># url (),()</span></span><br><span class="line">            <span class="keyword">if</span> current_path == url[<span class="number">0</span>]:</span><br><span class="line">                <span class="comment"># 将url对应的函数名赋值给func</span></span><br><span class="line">                func = url[<span class="number">1</span>]</span><br><span class="line">                <span class="keyword">break</span>  <span class="comment"># 匹配到一个之后 应该立刻结束for循环</span></span><br><span class="line">        <span class="comment"># 判断func是否有值</span></span><br><span class="line">        <span class="keyword">if</span> func:</span><br><span class="line">            res = func(env)</span><br><span class="line">        <span class="keyword">else</span>:</span><br><span class="line">            res = error(env)</span><br><span class="line"></span><br><span class="line">        <span class="keyword">return</span> [res.encode(<span class="string">&#x27;utf-8&#x27;</span>)]</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> __name__ == <span class="string">&#x27;__main__&#x27;</span>:</span><br><span class="line">        server = make_server(<span class="string">&#x27;127.0.0.1&#x27;</span>,<span class="number">8080</span>,run)</span><br><span class="line">        <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">        会实时监听127.0.0.1:8080地址 只要有客户端来了</span></span><br><span class="line"><span class="string">        都会交给run函数处理(加括号触发run函数的运行)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">        flask启动源码</span></span><br><span class="line"><span class="string">            make_server(&#x27;127.0.0.1&#x27;,8080,obj)</span></span><br><span class="line"><span class="string">            __call__</span></span><br><span class="line"><span class="string">        &quot;&quot;&quot;</span></span><br><span class="line">        server.serve_forever()  <span class="comment"># 启动服务端</span></span><br><span class="line">        </span><br><span class="line">        </span><br><span class="line">        </span><br><span class="line"><span class="comment"># urls.py  </span></span><br><span class="line">    <span class="keyword">from</span> views <span class="keyword">import</span> *</span><br><span class="line">    <span class="comment"># url与函数的对应关系</span></span><br><span class="line">    urls = [</span><br><span class="line">        (<span class="string">&#x27;/index&#x27;</span>,index),</span><br><span class="line">        (<span class="string">&#x27;/login&#x27;</span>,login),</span><br><span class="line">        (<span class="string">&#x27;/xxx&#x27;</span>,xxx),</span><br><span class="line">        (<span class="string">&#x27;/get_time&#x27;</span>,get_time),</span><br><span class="line">        (<span class="string">&#x27;/get_dict&#x27;</span>,get_dict),</span><br><span class="line">        (<span class="string">&#x27;/get_user&#x27;</span>,get_user)</span><br><span class="line">    ]</span><br><span class="line">    </span><br><span class="line"><span class="comment"># views.py</span></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">index</span>(<span class="params">env</span>):</span></span><br><span class="line">   		<span class="keyword">return</span> <span class="string">&#x27;index&#x27;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">login</span>(<span class="params">env</span>):</span></span><br><span class="line">        <span class="keyword">return</span> <span class="string">&quot;login&quot;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">error</span>(<span class="params">env</span>):</span></span><br><span class="line">        <span class="keyword">return</span> <span class="string">&#x27;404 error&#x27;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">xxx</span>(<span class="params">env</span>):</span></span><br><span class="line">        <span class="keyword">with</span> <span class="built_in">open</span>(<span class="string">r&#x27;templates/02 myxxx.html&#x27;</span>,<span class="string">&#x27;r&#x27;</span>,encoding=<span class="string">&#x27;utf-8&#x27;</span>) <span class="keyword">as</span> f:</span><br><span class="line">            <span class="keyword">return</span> f.read()</span><br><span class="line"></span><br><span class="line">    <span class="keyword">import</span> datetime</span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">get_time</span>(<span class="params">env</span>):</span></span><br><span class="line">        current_time = datetime.datetime.now().strftime(<span class="string">&#x27;%Y-%m-%d %X&#x27;</span>)</span><br><span class="line">        <span class="comment"># 如何将后端获取到的数据&quot;传递&quot;给html文件？</span></span><br><span class="line">        <span class="keyword">with</span> <span class="built_in">open</span>(<span class="string">r&#x27;templates/03 mytime.html&#x27;</span>,<span class="string">&#x27;r&#x27;</span>,encoding=<span class="string">&#x27;utf-8&#x27;</span>) <span class="keyword">as</span> f:</span><br><span class="line">            data = f.read()</span><br><span class="line">            <span class="comment"># data就是一堆字符串</span></span><br><span class="line">        data = data.replace(<span class="string">&#x27;dwadasdsadsadasdas&#x27;</span>,current_time)   <span class="comment"># 在后端将html页面处理好之后再返回给前端</span></span><br><span class="line">        <span class="keyword">return</span> data</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="keyword">from</span> jinja2 <span class="keyword">import</span> Template</span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">get_dict</span>(<span class="params">env</span>):</span></span><br><span class="line">        user_dic = &#123;<span class="string">&#x27;username&#x27;</span>:<span class="string">&#x27;jason&#x27;</span>,<span class="string">&#x27;age&#x27;</span>:<span class="number">18</span>,<span class="string">&#x27;hobby&#x27;</span>:<span class="string">&#x27;read&#x27;</span>&#125;</span><br><span class="line">        <span class="keyword">with</span> <span class="built_in">open</span>(<span class="string">r&#x27;templates/04 get_dict.html&#x27;</span>,<span class="string">&#x27;r&#x27;</span>,encoding=<span class="string">&#x27;utf-8&#x27;</span>) <span class="keyword">as</span> f:</span><br><span class="line">            data = f.read()</span><br><span class="line">        tmp = Template(data)</span><br><span class="line">        res = tmp.render(user=user_dic)</span><br><span class="line">        <span class="comment"># 给get_dict.html传递了一个值 页面上通过变量名user就能够拿到user_dict</span></span><br><span class="line">        <span class="keyword">return</span> res</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="keyword">import</span> pymysql</span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">get_user</span>(<span class="params">env</span>):</span></span><br><span class="line">        <span class="comment"># 去数据库中获取数据 传递给html页面 借助于模版语法 发送给浏览器</span></span><br><span class="line">        conn = pymysql.connect(</span><br><span class="line">            host = <span class="string">&#x27;127.0.0.1&#x27;</span>,</span><br><span class="line">            port = <span class="number">3306</span>,</span><br><span class="line">            user = <span class="string">&#x27;root&#x27;</span>,</span><br><span class="line">            password = <span class="string">&#x27;admin123&#x27;</span>,</span><br><span class="line">            db=<span class="string">&#x27;day59&#x27;</span>,</span><br><span class="line">            charset = <span class="string">&#x27;utf8&#x27;</span>,</span><br><span class="line">            autocommit = <span class="literal">True</span></span><br><span class="line">        )</span><br><span class="line">        cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)</span><br><span class="line">        sql = <span class="string">&#x27;select * from userinfo&#x27;</span></span><br><span class="line">        affect_rows = cursor.execute(sql)</span><br><span class="line">        data_list = cursor.fetchall()  <span class="comment"># [&#123;&#125;,&#123;&#125;,&#123;&#125;]</span></span><br><span class="line">        <span class="comment"># 将获取到的数据传递给html文件</span></span><br><span class="line">        <span class="keyword">with</span> <span class="built_in">open</span>(<span class="string">r&#x27;templates/05 get_data.html&#x27;</span>,<span class="string">&#x27;r&#x27;</span>,encoding=<span class="string">&#x27;utf-8&#x27;</span>) <span class="keyword">as</span> f:</span><br><span class="line">            data = f.read()</span><br><span class="line">        tmp = Template(data)</span><br><span class="line">        res = tmp.render(user_list=data_list)</span><br><span class="line">        <span class="comment"># 给get_dict.html传递了一个值 页面上通过变量名user就能够拿到user_dict</span></span><br><span class="line">        <span class="keyword">return</span> res</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> __name__ == <span class="string">&#x27;__main__&#x27;</span>:</span><br><span class="line">        get_user(<span class="number">111</span>)</span><br><span class="line">        </span><br><span class="line"><span class="number">2.</span> 总结</span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">urls.py						路由与视图函数对应关系</span></span><br><span class="line"><span class="string">views.py					视图函数(后端业务逻辑)</span></span><br><span class="line"><span class="string">templates文件夹		专门用来存储html文件</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="comment"># 按照功能的不同拆分之后 后续添加功能只需要在urls.py书写对应关系然后取views.py书写业务逻辑即可</span></span><br><span class="line"></span><br></pre></td></tr></table></figure>

<h2 id="三、动静态网页"><a href="#三、动静态网页" class="headerlink" title="三、动静态网页"></a>三、动静态网页</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> 什么是动静态网页</span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    静态网页</span></span><br><span class="line"><span class="string">        页面上的数据是直接写死的 万年不变</span></span><br><span class="line"><span class="string">    动态网页</span></span><br><span class="line"><span class="string">        数据是实时获取的</span></span><br><span class="line"><span class="string">        eg:</span></span><br><span class="line"><span class="string">            1.后端获取当前时间展示到html页面上</span></span><br><span class="line"><span class="string">            2.数据是从数据库中获取的展示到html页面上</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span>	</span><br><span class="line"></span><br><span class="line"><span class="number">2.</span> 代码演示(如何写动态网页)</span><br><span class="line">    <span class="comment"># 动态网页制作</span></span><br><span class="line">    <span class="keyword">import</span> datetime</span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">get_time</span>(<span class="params">env</span>):</span></span><br><span class="line">        current_time = datetime.datetime.now().strftime(<span class="string">&#x27;%Y-%m-%d %X&#x27;</span>)</span><br><span class="line">        <span class="comment"># 如何将后端获取到的数据&quot;传递&quot;给html文件？</span></span><br><span class="line">        <span class="keyword">with</span> <span class="built_in">open</span>(<span class="string">r&#x27;templates/03 mytime.html&#x27;</span>,<span class="string">&#x27;r&#x27;</span>,encoding=<span class="string">&#x27;utf-8&#x27;</span>) <span class="keyword">as</span> f:</span><br><span class="line">            data = f.read()</span><br><span class="line">            <span class="comment"># data就是一堆字符串</span></span><br><span class="line">        data = data.replace(<span class="string">&#x27;dwadasdsadsadasdas&#x27;</span>,current_time)   <span class="comment"># 在后端将html页面处理好之后再返回给前端</span></span><br><span class="line">        <span class="keyword">return</span> data</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 将一个字典传递给html文件 并且可以在文件上方便快捷的操作字典数据</span></span><br><span class="line">    <span class="keyword">from</span> jinja2 <span class="keyword">import</span> Template</span><br><span class="line">    <span class="function"><span class="keyword">def</span> <span class="title">get_dict</span>(<span class="params">env</span>):</span></span><br><span class="line">        user_dic = &#123;<span class="string">&#x27;username&#x27;</span>:<span class="string">&#x27;jason&#x27;</span>,<span class="string">&#x27;age&#x27;</span>:<span class="number">18</span>,<span class="string">&#x27;hobby&#x27;</span>:<span class="string">&#x27;read&#x27;</span>&#125;</span><br><span class="line">        <span class="keyword">with</span> <span class="built_in">open</span>(<span class="string">r&#x27;templates/04 get_dict.html&#x27;</span>,<span class="string">&#x27;r&#x27;</span>,encoding=<span class="string">&#x27;utf-8&#x27;</span>) <span class="keyword">as</span> f:</span><br><span class="line">            data = f.read()</span><br><span class="line">        tmp = Template(data)</span><br><span class="line">        res = tmp.render(user=user_dic)</span><br><span class="line">        <span class="comment"># 给get_dict.html传递了一个值 页面上通过变量名user就能够拿到user_dict</span></span><br><span class="line">        <span class="keyword">return</span> res</span><br><span class="line"></span><br><span class="line">	<span class="comment"># 后端获取数据库中数据展示到前端页面</span></span><br></pre></td></tr></table></figure>

<h2 id="四、模版语法之Jinja2模块"><a href="#四、模版语法之Jinja2模块" class="headerlink" title="四、模版语法之Jinja2模块"></a>四、模版语法之Jinja2模块</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">pip3 install jinja2</span><br><span class="line"><span class="string">&quot;&quot;&quot;模版语法是在后端起作用的&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 模版语法(非常贴近python语法)</span></span><br><span class="line">    &#123;&#123; user &#125;&#125;</span><br><span class="line">    &#123;&#123; user.get(<span class="string">&#x27;username&#x27;</span>)&#125;&#125;</span><br><span class="line">    &#123;&#123; user.age &#125;&#125;</span><br><span class="line">    &#123;&#123; user[<span class="string">&#x27;hobby&#x27;</span>] &#125;&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment"># for 循环</span></span><br><span class="line">    &#123;% <span class="keyword">for</span> user_dict <span class="keyword">in</span> user_list %&#125;</span><br><span class="line">                            &lt;tr&gt;</span><br><span class="line">                                &lt;td&gt;&#123;&#123; user_dict.<span class="built_in">id</span>&#125;&#125;&lt;/td&gt;</span><br><span class="line">                                &lt;td&gt;&#123;&#123; user_dict.username&#125;&#125;&lt;/td&gt;</span><br><span class="line">                                &lt;td&gt;&#123;&#123; user_dict.password&#125;&#125;&lt;/td&gt;</span><br><span class="line">                                &lt;td&gt;&#123;&#123; user_dict.hobby&#125;&#125;&lt;/td&gt;</span><br><span class="line">                            &lt;/tr&gt;</span><br><span class="line">    &#123;% endfor%&#125;</span><br></pre></td></tr></table></figure>

<h2 id="五、自定义简易版本web框架请求流程图"><a href="#五、自定义简易版本web框架请求流程图" class="headerlink" title="五、自定义简易版本web框架请求流程图"></a>五、自定义简易版本web框架请求流程图</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">wsgiref模块</span></span><br><span class="line"><span class="string">	1.请求来的时候解析http格式的数据 封装成大字典</span></span><br><span class="line"><span class="string">	2.响应走的时候给数据打包成符合http格式 再返回给浏览器</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br></pre></td></tr></table></figure>

<h2 id="六、python三大主流web框架"><a href="#六、python三大主流web框架" class="headerlink" title="六、python三大主流web框架"></a>六、python三大主流web框架</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">django</span></span><br><span class="line"><span class="string">	特点:大而全 自带的功能特别特别特别的多 类似于航空母舰</span></span><br><span class="line"><span class="string">	不足之处:</span></span><br><span class="line"><span class="string">		有时候过于笨重</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">flask</span></span><br><span class="line"><span class="string">	特点:小而精  自带的功能特别特别特别的少 类似于游骑兵</span></span><br><span class="line"><span class="string">	第三方的模块特别特别特别的多，如果将flask第三方的模块加起来完全可以盖过django</span></span><br><span class="line"><span class="string">	并且也越来越像django</span></span><br><span class="line"><span class="string">	不足之处:</span></span><br><span class="line"><span class="string">		比较依赖于第三方的开发者</span></span><br><span class="line"><span class="string">		</span></span><br><span class="line"><span class="string">tornado</span></span><br><span class="line"><span class="string">	特点:异步非阻塞 支持高并发</span></span><br><span class="line"><span class="string">		牛逼到甚至可以开发游戏服务器</span></span><br><span class="line"><span class="string">	不足之处:</span></span><br><span class="line"><span class="string">		暂时你不会</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">A:socket部分</span><br><span class="line">B:路由与视图函数对应关系(路由匹配)</span><br><span class="line">C:模版语法</span><br><span class="line"></span><br><span class="line">django</span><br><span class="line">	A用的是别人的		wsgiref模块</span><br><span class="line">	B用的是自己的</span><br><span class="line">	C用的是自己的(没有jinja2好用 但是也很方便)</span><br><span class="line"></span><br><span class="line">flask</span><br><span class="line">	A用的是别人的		werkzeug(内部还是wsgiref模块)</span><br><span class="line">	B自己写的</span><br><span class="line">	C用的别人的(jinja2)</span><br><span class="line"></span><br><span class="line">tornado</span><br><span class="line">	A，B，C都是自己写的</span><br></pre></td></tr></table></figure>

<h2 id="七、Django注意事项"><a href="#七、Django注意事项" class="headerlink" title="七、Django注意事项"></a>七、Django注意事项</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 如何让你的计算机能够正常的启动django项目</span></span><br><span class="line">	<span class="number">1.</span>计算机的名称不能有中文</span><br><span class="line">  <span class="number">2.</span>一个pycharm窗口只开一个项目</span><br><span class="line">  <span class="number">3.</span>项目里面所有的文件也尽量不要出现中文</span><br><span class="line">  <span class="number">4.</span>python解释器尽量使用<span class="number">3.4</span>~<span class="number">3.6</span>之间的版本</span><br><span class="line">  	(如果你的项目报错 你点击最后一个报错信息</span><br><span class="line">    去源码中把逗号删掉)</span><br><span class="line">    </span><br><span class="line"><span class="comment"># django版本问题</span></span><br><span class="line">	<span class="number">1.</span>X <span class="number">2.</span>X <span class="number">3.</span>X(直接忽略)</span><br><span class="line">  <span class="number">1.</span>X和<span class="number">2.</span>X本身差距也不大 我们讲解主要以<span class="number">1.</span>X为例 会讲解<span class="number">2.</span>X区别</span><br><span class="line">  公司之前用的<span class="number">1.8</span> 满满过渡到了<span class="number">1.11</span>版本 有一些项目用的<span class="number">2.0</span></span><br><span class="line"> </span><br><span class="line"><span class="comment"># django安装</span></span><br><span class="line">	pip3 install django==<span class="number">1.11</span><span class="number">.11</span></span><br><span class="line">  如果已经安装了其他版本 无需自己卸载</span><br><span class="line">  直接重新装 会自动卸载安装新的</span><br><span class="line">  </span><br><span class="line">  如果报错 看看是不是timeout 如果是 那么只是网速波动</span><br><span class="line">  重新安装即可</span><br><span class="line">  </span><br><span class="line">  验证是否安装成功的方式<span class="number">1</span></span><br><span class="line">  	终端输入django-admin看看有没有反应</span><br></pre></td></tr></table></figure>



<h2 id="八、Django基本操作"><a href="#八、Django基本操作" class="headerlink" title="八、Django基本操作"></a>八、Django基本操作</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br></pre></td><td class="code"><pre><span class="line"><span class="number">1.</span> 命令行操作</span><br><span class="line">	<span class="number">1.1</span> 创建django项目</span><br><span class="line">        <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">        你可以先切换到对应的D盘 然后再创建</span></span><br><span class="line"><span class="string">        &quot;&quot;&quot;</span></span><br><span class="line">        django-admin startproject mysite</span><br><span class="line">    </span><br><span class="line">      	manage.py</span><br><span class="line">      	mysite文件夹</span><br><span class="line">        	__init__.py</span><br><span class="line">        	settings.py</span><br><span class="line">            urls.py</span><br><span class="line">            wsgi.py</span><br><span class="line">     <span class="number">1.2</span> 启动django项目</span><br><span class="line">        <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">        一定要先切换到项目目录下	</span></span><br><span class="line"><span class="string">        cd /mysite</span></span><br><span class="line"><span class="string">        &quot;&quot;&quot;</span></span><br><span class="line">          python3 manage.py runserver</span><br><span class="line">          <span class="comment"># http://127.0.0.1:8000/</span></span><br><span class="line"> </span><br><span class="line">	<span class="number">1.3</span> 创建应用</span><br><span class="line">        <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">        Next, start your first app by running python manage.py startapp [app_label].</span></span><br><span class="line"><span class="string">        &quot;&quot;&quot;</span></span><br><span class="line">        python3 manage.py startapp app01</span><br><span class="line">        应用名应该做到见名知意</span><br><span class="line">          user</span><br><span class="line">          order</span><br><span class="line">          web</span><br><span class="line">          ...</span><br><span class="line">          但是我们示范就用app01/02/03/04</span><br><span class="line"></span><br><span class="line">        有很多文件</span><br><span class="line">  </span><br><span class="line"><span class="number">2.</span> pycharm操作</span><br><span class="line">	<span class="number">2.1</span> new project 选择左侧第二个django即可</span><br><span class="line">  </span><br><span class="line">  	<span class="number">2.2</span> 启动</span><br><span class="line">  		<span class="number">1.</span>还是用命令行启动</span><br><span class="line">    	<span class="number">2.</span>点击绿色小箭头即可</span><br><span class="line"></span><br><span class="line">  	<span class="number">2.3</span> 创建应用</span><br><span class="line">  		<span class="number">1.</span>pycharm提供的终端直接输入完整命令</span><br><span class="line">    	<span class="number">2.</span>pycharm </span><br><span class="line">      		tools </span><br><span class="line">        		run manage.py task提示(前期不要用 给我背完整命令)</span><br><span class="line">	<span class="number">2.4</span> 修改端口号以及创建server	</span><br><span class="line">		edit confi....</span><br><span class="line">  </span><br><span class="line"> </span><br></pre></td></tr></table></figure>

<h2 id="九、应用"><a href="#九、应用" class="headerlink" title="九、应用"></a>九、应用</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">django是一款专门用来开发app的web框架</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">django框架就类似于是一所大学(空壳子)</span></span><br><span class="line"><span class="string">app就类似于大学里面各个学院(具体功能的app)</span></span><br><span class="line"><span class="string">	比如开发淘宝</span></span><br><span class="line"><span class="string">		订单相关</span></span><br><span class="line"><span class="string">		用户相关</span></span><br><span class="line"><span class="string">		投诉相关</span></span><br><span class="line"><span class="string">		创建不同的app对应不同的功能</span></span><br><span class="line"><span class="string">	</span></span><br><span class="line"><span class="string">	选课系统</span></span><br><span class="line"><span class="string">		学生功能</span></span><br><span class="line"><span class="string">		老师功能</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">一个app就是一个独立的功能模块</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line">***********************创建的应用一定要去配置文件中注册**********************</span><br><span class="line">INSTALLED_APPS = [</span><br><span class="line">    <span class="string">&#x27;django.contrib.admin&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;django.contrib.auth&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;django.contrib.contenttypes&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;django.contrib.sessions&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;django.contrib.messages&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;django.contrib.staticfiles&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;app01.apps.App01Config&#x27;</span>,  <span class="comment"># 全写</span></span><br><span class="line">  	<span class="string">&#x27;app01&#x27;</span>,			 <span class="comment"># 简写</span></span><br><span class="line">]</span><br><span class="line"><span class="comment"># 创建出来的的应用第一步先去配置文件中注册 其他的先不要给我干</span></span><br><span class="line">ps:你在用pycharm创建项目的时候 pycharm可以帮你创建一个app并且自动注册</span><br><span class="line">***********************************************************************</span><br></pre></td></tr></table></figure>

<h2 id="十、主要文件介绍"><a href="#十、主要文件介绍" class="headerlink" title="十、主要文件介绍"></a>十、主要文件介绍</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">-mysite项目文件夹</span><br><span class="line">	--mysite文件夹</span><br><span class="line">  	---settings.py	配置文件</span><br><span class="line">    ---urls.py			路由与视图函数对应关系(路由层)</span><br><span class="line">    ---wsgi.py			wsgiref模块(不考虑)</span><br><span class="line">  --manage.py				django的入口文件</span><br><span class="line">  --db.sqlite3			django自带的sqlite3数据库(小型数据库 功能不是很多还有bug)</span><br><span class="line">  --app01文件夹</span><br><span class="line">  	---admin.py			django后台管理</span><br><span class="line">    ---apps.py			注册使用</span><br><span class="line">    ---migrations文件夹		数据库迁移记录</span><br><span class="line">    ---models.py		数据库相关的 模型类(orm)</span><br><span class="line">  	---tests.py			测试文件</span><br><span class="line">    ---views.py			视图函数(视图层)</span><br></pre></td></tr></table></figure>

<h2 id="十一、命令行与pycharm创建的区别"><a href="#十一、命令行与pycharm创建的区别" class="headerlink" title="十一、命令行与pycharm创建的区别"></a>十一、命令行与pycharm创建的区别</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 1 命令行创建不会自动有templatew文件夹 需要你自己手动创建而pycharm会自动帮你创建并且还会自动在配置文件中配置对应的路径</span></span><br><span class="line"><span class="comment"># pycharm创建</span></span><br><span class="line">TEMPLATES = [</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="string">&#x27;BACKEND&#x27;</span>: <span class="string">&#x27;django.template.backends.django.DjangoTemplates&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;DIRS&#x27;</span>: [os.path.join(BASE_DIR, <span class="string">&#x27;templates&#x27;</span>)]</span><br><span class="line">]</span><br><span class="line"><span class="comment"># 命令行创建</span></span><br><span class="line">TEMPLATES = [</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="string">&#x27;BACKEND&#x27;</span>: <span class="string">&#x27;django.template.backends.django.DjangoTemplates&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;DIRS&#x27;</span>: [],</span><br><span class="line">]</span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">也就意味着你在用命令创建django项目的时候不单单需要创建templates文件夹还需要去配置文件中配置路径</span></span><br><span class="line"><span class="string">&#x27;DIRS&#x27;: [os.path.join(BASE_DIR, &#x27;templates&#x27;)]</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br></pre></td></tr></table></figure>

<h2 id="十一、django小白必会三板斧"><a href="#十一、django小白必会三板斧" class="headerlink" title="十一、django小白必会三板斧"></a>十一、django小白必会三板斧</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">HttpResponse</span></span><br><span class="line"><span class="string">	返回字符串类型的数据</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">render</span></span><br><span class="line"><span class="string">	返回html文件的</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">redirect</span></span><br><span class="line"><span class="string">	重定向</span></span><br><span class="line"><span class="string">	  return redirect(&#x27;https://www.mzitu.com/&#x27;)</span></span><br><span class="line"><span class="string">    return redirect(&#x27;/home/&#x27;)</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br></pre></td></tr></table></figure>

<h2 id="十二、静态文件配置"><a href="#十二、静态文件配置" class="headerlink" title="十二、静态文件配置"></a>十二、静态文件配置</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 登陆功能</span></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">我们将html文件默认都放在templates文件夹下</span></span><br><span class="line"><span class="string">我们将网站所使用的静态文件默认都放在static文件夹下</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">静态文件</span></span><br><span class="line"><span class="string">	前端已经写好了的 能够直接调用使用的文件</span></span><br><span class="line"><span class="string">		网站写好的js文件</span></span><br><span class="line"><span class="string">		网站写好的css文件</span></span><br><span class="line"><span class="string">		网站用到的图片文件</span></span><br><span class="line"><span class="string">		第三方前端框架</span></span><br><span class="line"><span class="string">		...</span></span><br><span class="line"><span class="string">		拿来就可以直接使用的</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="comment"># django默认是不会自动帮你创建static文件夹 需要你自己手动创建</span></span><br><span class="line">一般情况下我们在static文件夹内还会做进一步的划分处理</span><br><span class="line">	-static</span><br><span class="line">  	--js</span><br><span class="line">    --css</span><br><span class="line">    --img</span><br><span class="line">    其他第三方文件</span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">在浏览器中输入url能够看到对应的资源</span></span><br><span class="line"><span class="string">是因为后端提前开设了该资源的借口</span></span><br><span class="line"><span class="string">如果访问不到资源 说明后端没有开设该资源的借口</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">http://127.0.0.1:8000/static/bootstrap-3.3.7-dist/css/bootstrap.min.css</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 静态文件配置</span></span><br><span class="line"></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">****************************************************************</span></span><br><span class="line"><span class="string">当你在写django项目的时候 可能会出现后端代码修改了但是前端页面没有变化的情况</span></span><br><span class="line"><span class="string">	1.你在同一个端口开了好几个django项目 </span></span><br><span class="line"><span class="string">		一直在跑的其实是第一个django项目</span></span><br><span class="line"><span class="string">	</span></span><br><span class="line"><span class="string">	2.浏览器缓存的问题</span></span><br><span class="line"><span class="string">		settings</span></span><br><span class="line"><span class="string">			network</span></span><br><span class="line"><span class="string">				disable cache 勾选上	</span></span><br><span class="line"><span class="string">*****************************************************************</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line">STATIC_URL = <span class="string">&#x27;/ooo/&#x27;</span>  <span class="comment"># 类似于访问静态文件的令牌</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;如果你想要访问静态文件 你就必须以static开头&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">/static/bootstrap-3.3.7-dist/js/bootstrap.min.js</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">/static/令牌</span></span><br><span class="line"><span class="string">取列表里面从上往下依次查找</span></span><br><span class="line"><span class="string">    bootstrap-3.3.7-dist/js/bootstrap.min.js</span></span><br><span class="line"><span class="string">    都没有才会报错</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="comment"># 静态文件配置</span></span><br><span class="line">STATICFILES_DIRS = [</span><br><span class="line">    os.path.join(BASE_DIR,<span class="string">&#x27;static&#x27;</span>),</span><br><span class="line">    os.path.join(BASE_DIR,<span class="string">&#x27;static1&#x27;</span>),</span><br><span class="line">    os.path.join(BASE_DIR,<span class="string">&#x27;static2&#x27;</span>),</span><br><span class="line">]</span><br><span class="line"></span><br><span class="line"><span class="comment"># 静态文件动态解析</span></span><br><span class="line">    &#123;% load static %&#125;</span><br><span class="line">    &lt;link rel=<span class="string">&quot;stylesheet&quot;</span> href=<span class="string">&quot;&#123;% static &#x27;bootstrap-3.3.7-dist/css/bootstrap.min.css&#x27; %&#125;&quot;</span>&gt;</span><br><span class="line">    &lt;script src=<span class="string">&quot;&#123;% static &#x27;bootstrap-3.3.7-dist/js/bootstrap.min.js&#x27; %&#125;&quot;</span>&gt;&lt;/script&gt;</span><br><span class="line">    </span><br><span class="line">    </span><br><span class="line"><span class="comment"># form表单默认是get请求数据</span></span><br><span class="line">	http://<span class="number">127.0</span><span class="number">.0</span><span class="number">.1</span>:<span class="number">8000</span>/login/?username=jason&amp;password=<span class="number">123</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">form表单action参数</span></span><br><span class="line"><span class="string">	1.不写 默认朝当前所在的url提交数据</span></span><br><span class="line"><span class="string">	2.全写 指名道姓</span></span><br><span class="line"><span class="string">	3.只写后缀 /login/</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 在前期我们使用django提交post请求的时候 需要取配置文件中注释掉一行代码</span></span><br><span class="line">MIDDLEWARE = [</span><br><span class="line">    <span class="string">&#x27;django.middleware.security.SecurityMiddleware&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;django.contrib.sessions.middleware.SessionMiddleware&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;django.middleware.common.CommonMiddleware&#x27;</span>,</span><br><span class="line">    <span class="comment"># &#x27;django.middleware.csrf.CsrfViewMiddleware&#x27;,</span></span><br><span class="line">    <span class="string">&#x27;django.contrib.auth.middleware.AuthenticationMiddleware&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;django.contrib.messages.middleware.MessageMiddleware&#x27;</span>,</span><br><span class="line">    <span class="string">&#x27;django.middleware.clickjacking.XFrameOptionsMiddleware&#x27;</span>,</span><br><span class="line">]</span><br></pre></td></tr></table></figure>

<h2 id="十三、request对象方法初识"><a href="#十三、request对象方法初识" class="headerlink" title="十三、request对象方法初识"></a>十三、request对象方法初识</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">request.method <span class="comment"># 返回请求方式 并且是全大写的字符串形式  &lt;class &#x27;str&#x27;&gt;</span></span><br><span class="line">request.POST  <span class="comment"># 获取用户post请求提交的普通数据不包含文件</span></span><br><span class="line">request.POST.get()  <span class="comment"># 只获取列表最后一个元素</span></span><br><span class="line">request.POST.getlist()  <span class="comment"># 直接将列表取出</span></span><br><span class="line">request.GET  <span class="comment"># 获取用户提交的get请求数据</span></span><br><span class="line">request.GET.get()  <span class="comment"># 只获取列表最后一个元素</span></span><br><span class="line">request.GET.getlist()  <span class="comment"># 直接将列表取出</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">get请求携带的数据是有大小限制的 大概好像只有4KB左右</span></span><br><span class="line"><span class="string">而post请求则没有限制</span></span><br><span class="line"><span class="string">&quot;&quot;&quot;</span></span><br><span class="line">  </span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">login</span>(<span class="params">request</span>):</span></span><br><span class="line">    <span class="comment"># 返回一个登陆界面</span></span><br><span class="line">    <span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">    get请求和post请求应该有不同的处理机制</span></span><br><span class="line"><span class="string">    :param request: 请求相关的数据对象 里面有很多简易的方法</span></span><br><span class="line"><span class="string">    :return:</span></span><br><span class="line"><span class="string">    &quot;&quot;&quot;</span></span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> request.method == <span class="string">&#x27;POST&#x27;</span>:</span><br><span class="line">        <span class="keyword">return</span> HttpResponse(<span class="string">&quot;收到了 宝贝&quot;</span>)</span><br><span class="line">    <span class="keyword">return</span> render(request, <span class="string">&#x27;login.html&#x27;</span>)</span><br></pre></td></tr></table></figure>

<h2 id="十四、Django生命周期流程图"><a href="#十四、Django生命周期流程图" class="headerlink" title="十四、Django生命周期流程图"></a>十四、Django生命周期流程图</h2><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 每个人都要会画 这个图是你们后期复习django最好的一个梳理方式</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 扩展知识点</span></span><br><span class="line">	<span class="string">&quot;&quot;&quot;</span></span><br><span class="line"><span class="string">	缓存数据库</span></span><br><span class="line"><span class="string">		提前已经将你想要的数据准备好了 你来直接拿就可以</span></span><br><span class="line"><span class="string">		提高效率和响应时间</span></span><br><span class="line"><span class="string">		</span></span><br><span class="line"><span class="string">	当你在修改你的数据的时候 你会发现数据并不是立刻修改完成的</span></span><br><span class="line"><span class="string">	而是需要经过一段时间才会修改</span></span><br><span class="line"><span class="string">		博客园</span></span><br><span class="line"><span class="string">	</span></span><br><span class="line"><span class="string">	了解即可</span></span><br><span class="line"><span class="string">	&quot;&quot;&quot;</span></span><br></pre></td></tr></table></figure>


            </div>

            <!-- Post Comments -->
            
    <!-- 使用 DISQUS_CLICK -->
<div id="disqus-comment">
    <div id="disqus_thread"></div>

<!-- add animation -->
<style>
	.disqus_click_btn {
            line-height: 30px;
            margin: 0;
            min-width: 50px;
            padding: 0 14px;
            display: inline-block;
            font-family: "Roboto", "Helvetica", "Arial", sans-serif;
            font-size: 14px;
            font-weight: 400;
            text-transform: uppercase;
            letter-spacing: 0;
            overflow: hidden;
            will-change: box-shadow;
            transition: box-shadow .2s cubic-bezier(.4, 0, 1, 1), background-color .2s cubic-bezier(.4, 0, .2, 1), color .2s cubic-bezier(.4, 0, .2, 1);
            outline: 0;
            cursor: pointer;
            text-decoration: none;
            text-align: center;
            vertical-align: middle;
            border: 0;
            background: rgba(158, 158, 158, .2);
            box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
            color: #fff;
            background-color: #7EC0EE;
            text-shadow: 0
        }
</style>
	
<div class="btn_click_load" id="disqus_bt"> 
    <button class="disqus_click_btn">点击查看评论</button>
</div>

<!--
<script type="text/javascript">
$('.btn_click_load').click(function() {
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = 'http-miccall-tech'; // required: replace example with your forum shortname

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
      var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
      dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
      (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();

    document.getElementById('disqus_bt').style.display = "none";
});
</script>
-->
<script type="text/javascript">
    var disqus_config = function () {
        this.page.url = 'https://gitee.com/AmeX/amelin-ting.git/2018/05/01/Django------%E5%9F%BA%E7%A1%80/';  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = 'https://gitee.com/AmeX/amelin-ting.git/2018/05/01/Django------%E5%9F%BA%E7%A1%80/'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
</script>

<script type="text/javascript">
    $('.btn_click_load').click(function() {  //click to load comments
        (function() { // DON'T EDIT BELOW THIS LINE
            var d = document;
            var s = d.createElement('script');
            s.src = '//http-miccall-tech.disqus.com/embed.js';
            s.setAttribute('data-timestamp', + new Date());
            (d.head || d.body).appendChild(s);
        })();
        $('.btn_click_load').css('display','none');
    });
</script>
</div>
<style>
    #disqus-comment{
        background-color: #eee;
        padding: 2pc;
    }
</style>


        </div>
        <!-- Copyright 版权 start -->
                <div id="copyright">
            <ul>
                <li>&copy;Powered By <a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/" style="border-bottom: none;">hexo</a></li>
                <li>Design: <a target="_blank" rel="noopener" href="http://miccall.tech " style="border-bottom: none;">miccall</a></li>
            </ul>
            
                <span id="busuanzi_container_site_pv">本站总访问量<span id="busuanzi_value_site_pv"></span>次</span>
			
        </div>
    </div>
</body>



 	
</html>
